﻿<%@ Page Title="ADMINISTRAR GRUPO" Language="vb" AutoEventWireup="false" MasterPageFile="~/01ADMINISTRADOR/MPAdmin.Master" CodeBehind="admin-grupo.aspx.vb" Inherits="ASI_2_UFG.admin_grupo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="tableform">
        <fieldset>
            <legend>Administrar Grupo</legend>
        </fieldset>
        <table>
            <tr>
                <td>
                    <asp:Label ID="Label1" runat="server" Text="ID"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtid_grupo" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label2" runat="server" Text="NUMERO"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtnumero" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label3" runat="server" Text="MATERIA"></asp:Label>
                </td>
                <td>
                    <asp:SqlDataSource ID="SQLMAteria" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" 
                        SelectCommand="select id_materia, {fn concat ( codigo, { fn concat (' - ', nombre )} )} as materia from materia"></asp:SqlDataSource>
                    <asp:DropDownList ID="dropMateria" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" 
                        SelectCommand="SELECT [id_materia] FROM [MATERIA]" 
                        DataSourceID="SQLMAteria" DataTextField="materia" DataValueField="id_materia">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label4" runat="server" Text="AULA"></asp:Label>
                </td>
                <td>
                    <asp:SqlDataSource ID="SQLAula" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" 
                        SelectCommand="select id_aula, { fn concat ( CAST  (numero as varchar ), {fn Concat (' - ' ,descripcion ) })} as aula from aula where estado='a'"></asp:SqlDataSource>
                    <asp:DropDownList ID="dropAula" runat="server" DataSourceID="SQLAula" 
                        DataTextField="aula" DataValueField="id_aula">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label5" runat="server" Text="HORARIO"></asp:Label>
                </td>
                <td>
                    <asp:SqlDataSource ID="SQLHorario" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" SelectCommand="select id_horario,
{FN CONCAT (CAST(hora_inicio as varchar), { FN CONCAT ( ' - ', CAST (hora_fin as varchar))}) } as HORARIO
FROM HORARIO"></asp:SqlDataSource>
                    <asp:DropDownList ID="dropHorario" runat="server" DataSourceID="SQLHorario" 
                        DataTextField="HORARIO" DataValueField="id_horario">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label6" runat="server" Text="PERSONAL"></asp:Label>
                </td>
                <td>
                    <asp:SqlDataSource ID="sqlPersonal" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" SelectCommand="SELECT p.id_personal, 
{FN CONCAT (CAST (CARNET AS VARCHAR), {FN CONCAT (' - ', {fn concat (apellidos, {fn concat (' ' , nombres)})})}) } AS PERSONAL
FROM PERSONAL AS p, ROL as r  WHERE P.id_rol = R.id_rol AND R.nombre='INSTRUCTOR'"></asp:SqlDataSource>
                    <asp:DropDownList ID="dropPersonal" runat="server" DataSourceID="sqlPersonal" 
                        DataTextField="PERSONAL" DataValueField="id_personal">
                    </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="Label7" runat="server" Text="DIA"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtdia" runat="server"></asp:TextBox>
                    <script>
                        $(function() {
                        $("#ctl00_ContentPlaceHolder1_txtdia").datepicker({ dateFormat: "DD" });
                        });
                    </script>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:ImageButton ID="btninsertar" runat="server" 
                        ImageUrl="~/IMAGES/funct_add.png" CssClass="image" />
                    <asp:ImageButton ID="btnModificar" runat="server" CssClass="image" 
                        ImageUrl="~/IMAGES/funct_refresh.png" />
                    <asp:ImageButton ID="btnEliminar" runat="server" CssClass="image" 
                        ImageUrl="~/IMAGES/funct_delete.png" />
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label ID="lbmensaje" runat="server" Text=""></asp:Label></td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ASI2UFG %>" 
                        
                        SelectCommand="select g.id_grupo, g.numero, m.codigo, a.numero, {fn concat ( cast (h.hora_inicio as varchar), {fn concat ('-',cast (h.hora_fin as varchar))})} as horario,
{fn concat (cast (p.carnet as varchar), {fn concat ('-', p.apellidos)})}, g.dia
FROM grupo as g, materia as m, aula as a, horario as h, personal as p
where g.id_materia = m.id_materia and g.id_aula= a.id_aula and g.id_horario=h.id_horario and g.id_personal=p.id_personal">
                    </asp:SqlDataSource>
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        CellPadding="4" DataKeyNames="id_grupo" DataSourceID="SqlDataSource1" 
                        ForeColor="#333333" GridLines="None">
                        <RowStyle BackColor="#EFF3FB" />
                        <Columns>
                            <asp:BoundField DataField="id_grupo" HeaderText="id_grupo" 
                                InsertVisible="False" ReadOnly="True" SortExpression="id_grupo" />
                            <asp:BoundField DataField="numero" HeaderText="numero" 
                                SortExpression="numero" />
                            <asp:BoundField DataField="codigo" HeaderText="codigo" 
                                SortExpression="codigo" />
                            <asp:BoundField DataField="numero1" HeaderText="numero1" 
                                SortExpression="numero1" />
                            <asp:BoundField DataField="horario" HeaderText="horario" 
                                SortExpression="horario" ReadOnly="True" />
                            <asp:BoundField DataField="Column1" HeaderText="Column1" 
                                SortExpression="Column1" ReadOnly="True" />
                            <asp:BoundField DataField="dia" HeaderText="dia" SortExpression="dia" />
                        </Columns>
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#2461BF" />
                        <AlternatingRowStyle BackColor="White" />
                    </asp:GridView>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>
